﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;

using iTextSharp.text;
using iTextSharp.text.pdf;

namespace iPdf
{
    class ImageConverter : Actor<DestinationItem, object>
    {
        protected override void Work()
        {
            Helper.VerifyItem(workItem.Source, workItem.Destination);

            Document doc = new Document();
            PdfWriter writer = PdfWriter.GetInstance(doc, File.OpenWrite(workItem.Destination));
            
            doc.Open();

            ImageToPdfConverter.ImageToPdfPage(doc, writer, workItem.Source);

            doc.Close();
        }
    }
}
